package io.github.eiot.json.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import io.github.eiot.codec.NumberUnit;

import java.io.IOException;

/**
 * @author yan
 * @since 2025-09-07
 */
public class NumberUtilSerializer extends JsonSerializer<NumberUnit> {
    @Override
    public void serialize(NumberUnit numberUnit, JsonGenerator jsonGenerator, SerializerProvider serializerProvider) throws IOException {
        jsonGenerator.writeNumber(numberUnit.doubleValue());
    }
}
